<?php
declare(strict_types=1);

namespace app\common\business;

use app\common\model\WebsiteConfig as WebsiteConfigModel;

class WebsiteConfig extends CommonBase
{
    private $_websiteConfigObj = null;

    public function __construct(string $websiteCode)
    {
        $this->_websiteCode      = $websiteCode;
        $this->_websiteConfigObj = new WebsiteConfigModel([], $websiteCode);
    }

    public function getWebsiteConfigInfo(string $cdnDomain): array
    {
        try {
            return $this->_websiteConfigObj->getWebsiteConfigInfo($cdnDomain);
        } catch (\Exception $e) {
            logErr('读取站点所有配置信息失败', sprintf('websiteCode:%s,method:%s,err:%s', $this->_websiteCode, __METHOD__, $e->getMessage()));
        }

        return [];
    }

}
